import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { SGuildWelcome } from "../../../../../Message/Game/SGuildWelcome";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { EOperOption } from "../../../../../Message/Game/EOperOption";
import { Language } from "../../../../../extend/language/Language";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
type int = number;
//class WelcomeInfoRenderer
    
    export  class WelcomeInfoRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=null;
            super.data = arg1;
            this._guildWelcome = arg1["guildWelcome"] as SGuildWelcome;
            this._index = arg1["index"] as int;
            if (this._guildWelcome) 
            {
                this.rankTxt.text = this._index.toString();
                loc1 = "【" + this._guildWelcome.fromPlayerPosition + "】" + this._guildWelcome.fromPlayer.name;
                if (this._guildWelcome.fromPlayer.VIP == 1) 
                {
                    loc1 = loc1 + "[VIP]";
                }
                this.nameTxt.htmlText = loc1;
                this.descTxt.text = this._guildWelcome.words + this.getOptionByType(this._guildWelcome.option);
            }
            return;
        }

        /* internal  */init(): void
        {
            this.rankTxt = ObjCreate.createTextField("", 30, 0, 35, 20, this);
            this.nameTxt = ObjCreate.createTextField("", 50, 0, 35, 20, this);
            this.nameTxt.selectable = false;
            this.nameTxt.mouseEnabled = false;
            this.nameTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this.descTxt = ObjCreate.createTextField("", 200, 0, 35, 20, this);
            this.descTxt.selectable = false;
            this.descTxt.mouseEnabled = false;
            this.descTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            ObjCreate.createBg(10, 25, 650, 2, this, ImagesConst.SplitLine);
            return;
        }

        /* internal  */getOptionByType(arg1: EOperOption): string
        {
            if (arg1.value() == EOperOption._EOperOptionExp) 
            {
                return Language.getString(57230);
            }
            if (arg1.value() == EOperOption._EOperOptionMoney) 
            {
                return Language.getString(57231);
            }
            if (arg1.value() == EOperOption._EOperOptionProp) 
            {
                return Language.getString(57232);
            }
            return "";
        }

        /* internal */ /* var */rankTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */nameTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */descTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_overSkin: ScaleBitmap;

        /* internal */ /* var */_index: int;

        /* internal */ /* var */_guildWelcome: SGuildWelcome;
    }
